<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    {% load static %}
    <link rel="stylesheet" href="{% static '/css/bootstrap.min.css' %}">
    <script src="{% static '/js/jquery-3.2.1.min.js' %}"></script>
    <script src="{% static '/js/bootstrap.min.js' %}"></script>
</head>
<body>
<h3>这里是后厨的主页</h3>
<a href="/adddishes/">添加新菜品</a>
<a href="/logout/">退出登录</a>
<table class="table">
    <tr>
        <td>订单ID</td>
        <td>下单时间</td>
        <td>客人姓名</td>
        <td>菜品名称</td>
        <td>操作员ID</td>
        <td>桌号</td>
        <td>是否完成</td>
        <td>操作</td>
        <td>剩余菜量</td>
    </tr>
{% for order in data  %}
    <tr>
        <td>{{ order.id }}</td>
        <td>{{ order.order_time }}</td>
        <td>{{ order.clientid }}</td>
        <td>{{ order.dishesid }}</td>
        <td>{{ order.operatorid }}</td>
        <td>{{ order.tableid }}</td>
        <td>{{ order.done }}</td>
        <td>
            {% if order.done %}
                <a href="/call/{{ order.id }}/">提醒服务生取菜</a>
            {% else %}
                <a href="/done/{{ order.id }}/">已完成菜品</a>
            {% endif %}
        </td>
        <td>
            {% if order.warn %}
                请注意剩余菜量
            {% else %}
                剩余菜量充足
            {% endif %}
        </td>
    </tr>
{% endfor %}
</table>
<table class="table table table-condensed">
    <tr>
        <td>ID</td>
        <td>食材名称</td>
        <td>剩余数量</td>
        <td>入库</td>
    </tr>
{% for ingr in ingrlist %}
    <tr>
        <td>{{ ingr.id }}</td>
        <td>{{ ingr.name }}</td>
        <td>{{ ingr.num }}</td>
        <td>
            <form action="/addingr/{{ ingr.id }}/" method="post">
                {% csrf_token %}
                指定入库数量<input type="number" name="num">
                <button>入库</button>
            </form>
        </td>
    </tr>
{% endfor %}
</table>
<form method="post" action="/newingr/">
    {% csrf_token %}
    新食材的名称<input type="text" name="ingr">
    新食材的数量<input type="number" name="num">
    <button>添加新菜品</button>
</form>
<table class="table">
    <tr>
        <td>ID</td>
        <td>时间</td>
        <td>源用户</td>
        <td>目标用户</td>
        <td>内容</td>
    </tr>
    {% for mess in messlist %}
        <tr>
        <td>{{ mess.id }}</td>
        <td>{{ mess.time }}</td>
        <td>{{ mess.sourceId.name }}</td>
        <td>{{ mess.targetId.name }}</td>
        <td>{{ mess.txt }}</td>
        </tr>
    {% endfor %}
</table>
</body>
</html>